package com.zhaoc.service.impl;

import com.zhaoc.dao.AreaRepository;
import com.zhaoc.domain.Area;
import com.zhaoc.service.IAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>title:com.zhaoc.service.impl</p>
 * date:2018/8/3 0003
 * time:0:00
 * author:赵成
 * user:13566
 */
@Service
@Transactional
public class AreaServiceImpl implements IAreaService {

    //自动注入dao层对象
    @Autowired
    private AreaRepository areaRepository;

    //添加区域信息
    @Override
    public void saveBatch(List<Area> list) {
        areaRepository.save(list);
    }

    //分页条件查询
    @Override
    public Page<Area> findPageData(Specification<Area> specification, Pageable pageable1) {
        return areaRepository.findAll(specification,pageable1);
    }
}
